#include <iostream>
#include <string>
using namespace std;

struct Student : public People
{
    double score;
};

struct People
{
    string name;
    int age;
};

void print(People people)
{
    people.age = 18;
    cout << "姓名：" << people.name << ",年龄:" << people.age << endl;
}

//传递指针
void print1(const People* people)
{
    // people->age = 23;
    //加入const之后，有修改操作就会报错，防止误操作
    cout << "姓名：" << people->name << ",年龄:" << people->age << endl;
}

//const防止结构体误操作

//people 与函数外定义的people不是同一个people；
//拷贝的数据量大，指针传递只有4个字节，数据更小；
// people.name = "李华";
int main()
{
    People p = {"张三", 15};
    print(p);
    print1(&p);
    cout << "姓名：" << p.name << ",年龄:" << p.age << endl;
}
